package cn.bonoon.util;

import java.util.HashMap;
import java.util.Map;

import cn.bonoon.entities.calendars.VacationEntity;
import cn.bonoon.kernel.util.StringHelper;

public class VacationInfo {
	private final Map<Integer, boolean[]> months;
	private final int year;
	public VacationInfo(VacationEntity ve){
		months = new HashMap<Integer, boolean[]>();
		year = ve.getYear();
		add(0, ve.getJan());
		add(1, ve.getFeb());
		add(2, ve.getMar());
		add(3, ve.getApr());
		add(4, ve.getMay());
		add(5, ve.getJun());
		add(6, ve.getJul());
		add(7, ve.getAug());
		add(8, ve.getSep());
		add(9, ve.getOct());
		add(10, ve.getNov());
		add(11, ve.getDec());
	}
	
	private void add(int i, String str){
		boolean[] ms = new boolean[32];
		int[] ds = StringHelper.tointArray(str);
		for (int j : ds) {
			ms[j] = true;
		}
		months.put(i, ms);
	}

	public int getYear() {
		return year;
	}

	public Map<Integer, boolean[]> getMonths() {
		return months;
	}
}
